package am.fp.events
{                           
  import flash.events.Event;
  
  public class PrintEvent extends Event
  {  
    public static const START: String = "startPrinting";
    public static const STATUS: String = "printStatus";
    public static const CANCEL: String = "printCancel";
    
    public static const STATUS_FINISHED: String = "finished";
    public static const STATUS_FAILED: String = "failed";
    public static const STATUS_CANCELED: String = "canceled";
    
    protected var m_pageNum: Array;
    protected var m_status: String;
    public function get pageNum(): Array { return m_pageNum; }
    public function get status(): String { return m_status;  }
    
    public function PrintEvent(type: String, pageNum: Array = null, status: String = null)
    {
      m_pageNum = pageNum;
      m_status = status;
      super(type, false, false);
    }
    
    public function get errorMessage(): String
    {
      if (!m_pageNum || m_pageNum.length != 1 || m_status != STATUS_FAILED)
        return "";
      return m_pageNum[0];
    }
  }
}
